#pragma once

#ifndef __SceneController_H__
#define __SceneController_H__

//#define PAGING

#define TERRAIN_PAGE_MIN_X 0
#define TERRAIN_PAGE_MIN_Y 0
#define TERRAIN_PAGE_MAX_X 0
#define TERRAIN_PAGE_MAX_Y 0

#include <Ogre.h>
#include <OgreRoot.h>

#include <Terrain\OgreTerrain.h>
#include <Terrain\OgreTerrainGroup.h>	
#include <Terrain\OgreTerrainQuadTreeNode.h>
#include <Terrain\OgreTerrainMaterialGeneratorA.h>
#include <Terrain\OgreTerrainPaging.h>

#define TERRAIN_FILE_PREFIX String("testTerrain")
#define TERRAIN_FILE_SUFFIX String("dat")
#define TERRAIN_WORLD_SIZE 12000.0f
#define TERRAIN_SIZE 513

using namespace Ogre;

class SceneController
{
public:
	SceneController(SceneManager* sceneMgr);
	~SceneController(void);
	
	Ogre::SceneManager* mSceneMgr;

	TerrainGlobalOptions* mTerrainGlobals;
	TerrainGroup* mTerrainGroup;
	bool mPaging;
	TerrainPaging* mTerrainPaging;
	PageManager* mPageManager;

	Vector3 mTerrainPos;

	bool mTerrainsImported;

	void configureTerrainDefaults(Light* l);
	void defineTerrain(long x, long y, bool flat);
	void destroyScene();
	void getTerrainImage(bool flipX, bool flipY, Image& img);
	void initBlendMaps(Terrain* terrain);
	void initialize(SceneManager* sceneMgr);
	void loadScene(String sceneName);
	
};


#endif
